package com.gupao.javavip.dubbo.client;

import lombok.extern.apachecommons.CommonsLog;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.Optional;

@CommonsLog
@Component
public class KafkaMsgConsumer {

    @KafkaListener(topics = {"test"})
    public void listener(ConsumerRecord record) {
        Optional<?> msg = Optional.ofNullable(record.value());
        msg.ifPresent(o -> log.info(msg.get()));
    }
}
